import QtQuick 2.0

BrightSquare {
    id:root
    width: 600
    height: 400
    property int  duration: 3000
    property Item ufo: ufo

    Image {
        anchors.fill: parent
        source: "assets/ufo_background.png"
    }

    MouseArea{
        id:getset
        anchors.fill: parent
        onClicked: {
            anim.stop()
            ufo.x = 20
            ufo.y = root.height-ufo.height
        }
    }
    ClickableImageV2{
       id: ufo
       x:20; y:root.height - height
       labelColor: "black"
       text:" 吉法师 "
       source: "assets/ufo.png"
       onClicked: anim.restart()

    }
    SequentialAnimation{  //连续动画
        id:anim
        NumberAnimation{
             target: ufo
             properties: "y"
             to:20
             // 60% of time to travel up
             duration: root.duration*0.6
        }

        NumberAnimation{
             target: ufo
             properties: "x"
             to:400
             // 40% of time to travel sideways
             duration: root.duration*0.4
        }
    }




}
